fix(mcp): fix SSE transport host binding and remove invalid sse_params kwarg#17
Open
eddiefleurent wants to merge 1 commit intoHKUDS:mainfrom
Open
fix(mcp): fix SSE transport host binding and remove invalid sse_params kwarg#17eddiefleurent wants to merge 1 commit intoHKUDS:mainfrom
eddiefleurent wants to merge 1 commit intoHKUDS:mainfrom
Conversation
…s kwarg - FastMCP defaults to 127.0.0.1 which prevents remote connections when running SSE transport. Default to 0.0.0.0 and allow override via FASTMCP_HOST / FASTMCP_PORT env vars. - mcp.run() does not accept sse_params kwarg (raises TypeError). Remove it. The --port arg was always a no-op since FastMCP is instantiated at module level before args are parsed; use FASTMCP_PORT env var instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Two bugs prevent the MCP SSE transport from working:
1.
TypeErroron startupmcp.run()is called withsse_params={"port": args.port}but themcplibrary'sFastMCP.run()does not accept asse_paramskeyword argument, causing an immediate crash:2. SSE server binds to
127.0.0.1(localhost only)FastMCPdefaults tohost="127.0.0.1", so when running SSE transport the server is unreachable from any other machine — making remote MCP clients (Claude Code, Cursor, etc.) unable to connect.Fix
hostandportdirectly to theFastMCPconstructor, defaulting to0.0.0.0:8080with overrides viaFASTMCP_HOST/FASTMCP_PORTenv varssse_paramskwarg frommcp.run()Note: the
--portCLI arg was already a no-op sinceFastMCPis instantiated at module level before args are parsed. Users should useFASTMCP_PORTenv var to configure the port.Usage after fix